package com.rzjm.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rzjm.api.dao.FireWorkUserDao;
import com.rzjm.api.entity.FireWorkUser;
import com.rzjm.api.service.FireWorkUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class FireWorkUserServiceImpl extends BaseServiceImpl<FireWorkUserDao, FireWorkUser> implements FireWorkUserService {

    @Resource
    private FireWorkUserDao fireWorkUserDao;

    @Override
    public FireWorkUser getUserBySysUserId(int fireWorkId, long sysUserId) {
        QueryWrapper<FireWorkUser> qw = new QueryWrapper<>();
        qw.eq("fire_work_id", fireWorkId);
        qw.eq("worker_sys_user_id", sysUserId);
        qw.last("limit 1");
        return fireWorkUserDao.selectOne(qw);
    }
}
